#ifndef _UTILS_SCREEN_FACTORY_H_
# define _UTILS_SCREEN_FACTORY_H_

# include "config.h"
# include <map>
# include <string>
# include "Utils\\IScreen.h"
# include "Utils\\IArgs.h"

NS_BEGIN(SDL)
	NS_BEGIN(UTILS)
	
	class ScreenFactory
	{
	public:
		typedef IScreen* (*ScreenCreator)(IArgs*);
	private:
		static ScreenFactory& m_instance;
		std::map<std::string, ScreenCreator> m_creators;

	protected:
		ScreenFactory();
	private:
		ScreenFactory(ScreenFactory const&);
	protected:
		~ScreenFactory();

	private:
		ScreenFactory& operator=(ScreenFactory const&);
	public:
		ScreenCreator operator[](std::string const& _name);

	public:
		static ScreenFactory& Instance();

		bool AddCreator(std::string const& _name, ScreenCreator _screenCreator);
		bool RemoveCreator(std::string const& _name);
		void ClearCreators();
		IScreen* Create(std::string const& _name, IArgs* _args = NULL);

		std::map<std::string, ScreenCreator> const& GetCreators() const;
	};

	NS_END(UTILS)
NS_END(SDL)

#endif // _UTILS_SCREEN_FACTORY_H_